package com.example.springboot159.bean.dataSync;


import com.alibaba.fastjson.JSON;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

public class Test {

    public static void main(String[] args) {

        DataBase base = new DataBase.Builder()
                .item_id("item_id")
                .title("title")
                .province_id("province_id")
                .id("id")
                .name("name")
                .client_ver("client_ver")
                .jump_type(1)
                .type_flag("type_flag")
                .status("status")
                .login_flag("login_flag")
                .data_type(2)
                .datasource_type(3)
                .city_id("city_id")
                .build();
        System.out.println(JSON.toJSONString(base));




    }

    public  List<DataBase> getA(List<DataBase> vals){
        List<DataBase> bases = new ArrayList<>();
        if (!CollectionUtils.isEmpty(vals)){
            for (DataBase var:vals){
                DataBase base = new DataBase.Builder()
                        .item_id(var.getItem_id())
                        .title(var.getTitle())
                        .province_id(var.getProvince_id())
                        .id(var.getId())
                        .name(var.getName())
                        .client_ver(var.getClient_ver())
                        .jump_type(var.getJump_type())
                        .type_flag(var.getType_flag())
                        .status(var.getStatus())
                        .login_flag(var.getClient_ver())
                        .data_type(var.getData_type())
                        .datasource_type(var.getDatasource_type())
                        .city_id(var.getCity_id())
                        .build();
                bases.add(base);
            }
        }
        return bases;
    }
}
